# Lampedusa 1

data61$lamp <- as.numeric(data61$date) - 15980
rdlamp1 <- RDestimate(factor ~ lamp, data = data61, cutpoint = 0, bw = 30)
summary(rdlamp1) 

data62$lamp <- as.numeric(data62$date) - 15980
rdlamp2 <- RDestimate(factor ~ lamp, data = data62, cutpoint = 0, bw = 30)
summary(rdlamp2)

# 31.08.2014
data71$one <- as.numeric(data71$date) - 16312
rd1 <- RDestimate(factor ~ one | cntry, data = data71, cutpoint = 0, bw = 30)
summary(rd1)

data72$one <- as.numeric(data72$date) - 16312
rd1b <- RDestimate(factor ~ one | cntry, data = data72, cutpoint = 0, bw = 30)
summary(rd1b)

# 14.09.2014
data71$two <- as.numeric(data71$date) - 16326
rd2 <- RDestimate(factor ~ two | cntry, data = data71, cutpoint = 0, bw = 30)
summary(rd2)

data72$two <- as.numeric(data72$date) - 16326
rd2b <- RDestimate(factor ~ two | cntry, data = data72, cutpoint = 0, bw = 30)
summary(rd2b)

# 08.02.2015
data71$three <- as.numeric(data71$date) - 16473
rd3 <- RDestimate(factor ~ three | cntry, data = data71, cutpoint = 0, bw = 30)
summary(rd3)

data72$three <- as.numeric(data72$date) - 16473
rd3b <- RDestimate(factor ~ three | cntry, data = data72, cutpoint = 0, bw = 30)
summary(rd3b)

# 18.04.2015
data71$four <- as.numeric(data71$date) - 16542
rd4 <- RDestimate(factor ~ four | cntry, data = data71, cutpoint = 0, bw = 30)
summary(rd4)

data72$four <- as.numeric(data72$date) - 16542
rd4b <- RDestimate(factor ~ four | cntry, data = data72, cutpoint = 0, bw = 30)
summary(rd4b)

# 21.09.2016
data81$five <- as.numeric(data81$date) - 17064
rd5 <- RDestimate(factor ~ five | cntry, data = data81, cutpoint = 0, bw = 30)
summary(rd5)

data82$five <- as.numeric(data82$date) - 17064
rd5b <- RDestimate(factor ~ five | cntry, data = data82, cutpoint = 0, bw = 30)
summary(rd5b)

# 02.11.2016
data81$six <- as.numeric(data81$date) - 17106
rd6 <- RDestimate(factor ~ six | cntry, data = data81, cutpoint = 0, bw = 30)
summary(rd6)

data82$six <- as.numeric(data82$date) - 17106
rd6b <- RDestimate(factor ~ six | cntry, data = data82, cutpoint = 0, bw = 30)
summary(rd6b)

# 14.11.2016
data81$seven <- as.numeric(data81$date) - 17118
rd7 <- RDestimate(factor ~ seven | cntry, data = data81, cutpoint = 0, bw = 30)
summary(rd7)

data82$seven <- as.numeric(data82$date) - 17118
rd7b <- RDestimate(factor ~ seven | cntry, data = data82, cutpoint = 0, bw = 30)
summary(rd7b)


# 14.01.2017
data81$eight <- as.numeric(data81$date) - 17179
rd8 <- RDestimate(factor ~ eight | cntry, data = data81, cutpoint = 0, bw = 30)
summary(rd8)

data82$eight <- as.numeric(data82$date) - 17179
rd8b <- RDestimate(factor ~ eight | cntry, data = data82, cutpoint = 0, bw = 30)
summary(rd8b)

# 20.02.2017
data81$nine <- as.numeric(data81$date) - 17216
rd9 <- RDestimate(factor ~ nine | cntry, data = data81, cutpoint = 0, bw = 30)
summary(rd9)

data82$nine <- as.numeric(data82$date) - 17216
rd9b <- RDestimate(factor ~ nine | cntry, data = data82, cutpoint = 0, bw = 30)
summary(rd9b)

# 23.03.2017
data81$ten <- as.numeric(data81$date) - 17247
rd10 <- RDestimate(factor ~ ten | cntry, data = data81, cutpoint = 0, bw = 30)
summary(rd10)

data82$ten <- as.numeric(data82$date) - 17247
rd10b <- RDestimate(factor ~ ten | cntry, data = data82, cutpoint = 0, bw = 30)
summary(rd10b)

# 16.04.2017
data81$eleven <- as.numeric(data81$date) - 17271
rd11 <- RDestimate(factor ~ eleven | cntry, data = data81, cutpoint = 0, bw = 30)
summary(rd11)

data82$eleven <- as.numeric(data82$date) - 17271
rd11b <- RDestimate(factor ~ eleven | cntry, data = data82, cutpoint = 0, bw = 30)
summary(rd11b)

# 17.06.2017
data81$twelve <- as.numeric(data81$date) - 17333
rd12 <- RDestimate(factor ~ twelve | cntry, data = data81, cutpoint = 0, bw = 30)
summary(rd12)

data82$twelve <- as.numeric(data82$date) - 17333
rd12b <- RDestimate(factor ~ twelve | cntry, data = data82, cutpoint = 0, bw = 30)
summary(rd12b)

# 18.01.2019
data91$thirteen <- as.numeric(data91$date) - 17913
rd13 <- RDestimate(factor ~ thirteen | cntry, data = data91, cutpoint = 0, bw = 30)
summary(rd13)

data92$thirteen <- as.numeric(data92$date) - 17913
rd13b <- RDestimate(factor ~ thirteen | cntry, data = data92, cutpoint = 0, bw = 30)
summary(rd13b)

### 18.01.2019 ITALY ONLY ###
data91$thirteen <- as.numeric(data91$date) - 17913

data91IT <- data91 %>% 
  filter(cntry == "IT")
rd13IT <- RDestimate(factor ~ thirteen, data = data91IT, cutpoint = 0, bw = 30)
summary(rd13IT)

data92$thirteen <- as.numeric(data92$date) - 17913

data92IT <- data92 %>% 
  filter(cntry == "IT")
rd13bIT <- RDestimate(factor ~ thirteen, data = data92IT, cutpoint = 0, bw = 30)
summary(rd13bIT)

# 04.12.2019
data91$fourteen <- as.numeric(data91$date) - 18233
rd14 <- RDestimate(factor ~ fourteen | cntry, data = data91, cutpoint = 0, bw = 30)
summary(rd14)

data92$fourteen <- as.numeric(data92$date) - 18233
rd14b <- RDestimate(factor ~ fourteen | cntry, data = data92, cutpoint = 0, bw = 30)
summary(rd14b)

# 17.12.2021
data101$fifteen <- as.numeric(data101$date) - 18977
rd15 <- RDestimate(factor ~ fifteen | cntry, data = data101, cutpoint = 0, bw = 30)
summary(rd15)

data102$fifteen <- as.numeric(data102$date) - 18977
rd15b <- RDestimate(factor ~ fifteen | cntry, data = data102, cutpoint = 0, bw = 30)
summary(rd15b)

### 17.12.2021 ITALY ONLY ###

data101$fifteen <- as.numeric(data101$date) - 18977

data101IT <- data101 %>% 
  filter(cntry == "IT")
rd15IT <- RDestimate(factor ~ fifteen, data = data101IT, cutpoint = 0, bw = 30)
summary(rd15IT)

data102$fifteen <- as.numeric(data102$date) - 18977

data102IT <- data102 %>% 
  filter(cntry == "IT")
rd15bIT <- RDestimate(factor ~ fifteen, data = data102IT, cutpoint = 0, bw = 30)
summary(rd15bIT)
